Skip to content

fix(notifications): Handle null provider in organization integrations filter#112368

Merged
mtopo27 merged 2 commits intomasterfrom
mtopo27/fix-notifications-page
Apr 7, 2026
Merged

fix(notifications): Handle null provider in organization integrations filter#112368
mtopo27 merged 2 commits intomasterfrom
mtopo27/fix-notifications-page

Conversation

@mtopo27
Copy link
Copy Markdown
Contributor

@mtopo27 mtopo27 commented Apr 7, 2026

Handle null provider in the organization integrations filter on the
notification settings page.

The /users/me/organization-integrations/ API can return entries with a
null provider field. The ALLOWED_PROVIDERS filter added in #111745
accesses orgIntegration.provider.key without null safety, crashing the
page with TypeError: Cannot read properties of null (reading 'provider').

Adds optional chaining to match the pattern already used for the identity
provider filter a few lines above.

handles JAVASCRIPT-38j8 & JAVASCRIPT-38N4

… filter

The organization integrations filter crashes when an entry has a null
provider, causing the notification settings page to error. Add optional
chaining to match the pattern already used for identity filtering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 7, 2026
@mtopo27 mtopo27 marked this pull request as ready for review April 7, 2026 15:36
@mtopo27 mtopo27 requested a review from a team as a code owner April 7, 2026 15:36
Copy link
Copy Markdown
Member

@leeandher leeandher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for jumping on this!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix the types instead:

- useApiQuery<OrganizationIntegration[]>(
+ useApiQuery<Array<OrganizationIntegration | null>>(

in that case, TypeScript will force us to add the optional chaining. Also, it’s doubtful that if we get an integration, it has no key, so we’d only need:

ALLOWED_PROVIDERS.has(orgIntegration?.provider.key as SupportedProviders)

Update the useApiQuery type parameter to Array<OrganizationIntegration | null>
to reflect that entries can be null. Add a type guard on the filter so
downstream code retains the narrowed OrganizationIntegration type.
Remove unnecessary optional chaining on provider.key since a non-null
integration should always have a provider.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mtopo27 mtopo27 merged commit c95349c into master Apr 7, 2026
68 checks passed
@mtopo27 mtopo27 deleted the mtopo27/fix-notifications-page branch April 7, 2026 16:34
leeandher added a commit that referenced this pull request Apr 8, 2026
…ialization (#112391)

some integrations failed to serialize, causing `null`s to appear in the
list apis:

<img width="1380" height="208" alt="image"
src="https://github.com/user-attachments/assets/1c90c40d-edd1-43ff-bcae-930bc4be9d9d"
/>

this breaks frontend type assertions which necessitated the patch in
#112368
to avoid the page crashing

[the logs in
sentry](https://sentry.sentry.io/issues/7384876727/?project=11276#logs)
confirm that there were entries that failed to serialize here:

<img width="473" height="90" alt="image"
src="https://github.com/user-attachments/assets/3733161c-5df1-4907-830b-1bc262476bba"
/>

This fix will omit `None` entries from the response, so the frontend can
be reset to being type safe, and add some more logging we can look into
about why certain bad integrations can't be serialized. +tests

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@example.com>
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
… filter (#112368)

Handle null provider in the organization integrations filter on the
notification settings page.

The `/users/me/organization-integrations/` API can return entries with a
null `provider` field. The `ALLOWED_PROVIDERS` filter added in #111745
accesses `orgIntegration.provider.key` without null safety, crashing the
page with `TypeError: Cannot read properties of null (reading
'provider')`.

Adds optional chaining to match the pattern already used for the
identity
provider filter a few lines above.

handles JAVASCRIPT-38j8 & JAVASCRIPT-38N4

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…ialization (#112391)

some integrations failed to serialize, causing `null`s to appear in the
list apis:

<img width="1380" height="208" alt="image"
src="https://github.com/user-attachments/assets/1c90c40d-edd1-43ff-bcae-930bc4be9d9d"
/>

this breaks frontend type assertions which necessitated the patch in
#112368
to avoid the page crashing

[the logs in
sentry](https://sentry.sentry.io/issues/7384876727/?project=11276#logs)
confirm that there were entries that failed to serialize here:

<img width="473" height="90" alt="image"
src="https://github.com/user-attachments/assets/3733161c-5df1-4907-830b-1bc262476bba"
/>

This fix will omit `None` entries from the response, so the frontend can
be reset to being type safe, and add some more logging we can look into
about why certain bad integrations can't be serialized. +tests

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants